﻿namespace EasyGo.Services.Impl
{
    using System.Collections.Generic;
    using EasyGo.Data.Dao;
    using EasyGo.Domain.Projections;
    using EasyGo.Domain.Model;

    public class UserAccountService: Service, IUserAccountService
    {
        private readonly IUserAccountDao dao;

        public UserAccountService(IUserAccountDao dao)
        {
            this.dao = dao;
        }

        public IEnumerable<ListUser> GetAll()
        {
            return this.dao.GetAllListUsers();
        }

        public UserAccount CreateUser(UserAccount userAccount)
        {
            int id = this.dao.CreateUser(userAccount);
            userAccount.Id = id;
            this.SaveChanges();
            return userAccount;
        }

        public UserAccount GetUser(int id)
        {
            return this.dao.GetUser(id);
        }
    }
}
